import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '送样单位',
    align: "center",
    dataIndex: 'partName'
  },
  {
    title: '报废名称',
    align: "center",
    dataIndex: 'discardName'
  },
  {
    title: '送样时间',
    align: "center",
    sorter: true,
    dataIndex: 'date',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '送样人',
    align: "center",
    dataIndex: 'deliverPerson'
  },
  {
    title: '收样人',
    align: "center",
    dataIndex: 'receivePerson'
  },
  {
    title: '存放地点',
    align: "center",
    dataIndex: 'savePlace'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "送样单位",
    field: 'partName',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "送样时间",
    field: "date",
    component: 'RangePicker',
    colProps: {span: 6},
  },
  {
    label: "送样人",
    field: 'deliverPerson',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "收样人",
    field: 'receivePerson',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '送样单位',
    field: 'partName',
    component: 'Input',
  },
  {
    label: '报废名称',
    field: 'discardName',
    component: 'Input',
  },
  {
    label: '送样时间',
    field: 'date',
    component: 'DatePicker',
  },
  {
    label: '送样人',
    field: 'deliverPerson',
    component: 'Input',
  },
  {
    label: '收样人',
    field: 'receivePerson',
    component: 'Input',
  },
  {
    label: '存放地点',
    field: 'savePlace',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
